package com.techblor.lock.library;

/**
 * 类描述：分布式锁接口类
 */
public interface DistLock {

    /**
     * 加锁
     *
     * @param key            key
     * @param acquireTimeout 获得锁的超时时间
     * @param expire         自动失效时间
     * @param sleep          线程睡眠时间
     * @return
     */
    LockEntry lock(final String key, final int acquireTimeout, final long expire, final int sleep);

    /**
     * 加锁
     *
     * @param key
     * @param acquireTimeout
     * @param expire
     * @return
     */
    LockEntry lock(final String key, final int acquireTimeout, final long expire);

    /**
     * 加锁
     *
     * @param key
     * @param expire
     * @return
     */
    LockEntry lock(final String key, final long expire);

    /**
     * 加锁
     *
     * @param key
     * @return
     */
    LockEntry lock(final String key);


    /**
     * 解锁
     *
     * @param lockEntry
     */
    void unlock(final LockEntry lockEntry);

}
